const Mock = require('mockjs')

module.exports = {
    'get /grsq'(req, res) {
        res.status(200).json(Mock.mock({
            'data': {
                'user_num|100-1000': 0,
                'dingdanl|100-1000': 0,
                'xf_total|100-1000': 0,

                'gxsq_list|1-5': [{
                    'user_id|1-100': 0,
                    'user_name': '@cname()',
                    'Telephone': /^1[35678]{10}$/,
                    'sqdp_num|10-100': 0,
                    'dingdanl|10-100': 0,
                    'xiaofei_e': '@float(100,1000,2,2)',
                    'xiaofei_pc|1-10': 0,
                }]
            },
            'message': '获取成功',
            'status': 200
        }))
    },


    //消费分析接口数据
    'post /consumption/:id'(req, res) {
        // console.log(req.params.id);
        res.status(200).json(Mock.mock({
            'data': {
                'user_id': req.params.id,
                'user_name': '@cname()',
                'Telephone': /^1[35678]{10}$/,
                'start_date': '@date("yyyy-MM-dd")',
                'end_data': '@date("yyyy-MM-dd")',

                'dingdan_total|10-100': 0,
                'dingdan_zonge': '@float(1000,10000,2,2)',

                'consumption_list|1-5': [{
                    'sh_bianhao|10-100': 0,
                    'sh_name': '@cword(3)',
                    'hangye': '林业',
                    'dingdan_sp_num|1-10': 0,
                    'dingdan_price': '@float(10,100,2,2)',
                    'xf_date': '@date("yyyy-MM-dd")',
                }],

                'option': {
                    'tooltip': {
                        'trigger': "item",
                        'formatter': "{a} <br/>{b} : {c} ({d}%)",
                    },
                    'color': ["skyblue", "pink", "#09f"],
                    'series': [{
                        'name': "数据总额",
                        'type': "pie",
                        'radius': "55%",
                        'center': ["50%", "60%"],
                        'data': [{
                                'value|100-1000': 0,
                                'name': "居家必备:" + "@float(10,100,2,2)" + "元"
                            },
                            {
                                'value|100-1000': 0,
                                'name': "生鲜:" + "@float(10,100,2,2)" + "元"
                            },
                            {
                                'value|100-1000': 0,
                                'name': "便利食品:" + "@float(10,100,2,2)" + "元"
                            },
                        ],
                        'emphasis': {
                            'itemStyle': {
                                'shadowBlur': 10,
                                'shadowOffsetX': 0,
                                'shadowColor': "rgba(0, 0, 0, 0.5)",
                            },
                        },
                    }, ],
                },
                'status': 200,
                'message': '获取成功'
            }
        }))
    }
}